package jgl.vajra.operator.part.mine.viewModel;

import java.util.List;
import java.util.Map;

import jgl.vajra.operator.part.mine.contract.CarNameContract;
import jgl.vajra.operator.part.mine.model.CarNameModel;
import jgl.vajra.operator.widget.mvvm.factory.CreateModel;
import jgl.vajra.operator.widget.retrofithelper.rxsubscriber.ProgressObserver;

@CreateModel(CarNameModel.class)
public class CarNameViewModel extends CarNameContract.ViewModel{
    @Override
    public void getCarDefaultName(Map<String, Object> map) {
        mModel.getCarDefaultName(map).subscribe(new ProgressObserver<List<String>>(true,this) {
            @Override
            public void _onNext(List<String> data) {
                mView.returnCarDefaultName(data);
            }
        });
    }

    @Override
    public void carModifyTitle(Map<String, Object> map) {
        mModel.carModifyTitle(map).subscribe(new ProgressObserver<String>(true,this) {
            @Override
            public void _onNext(String data) {
                mView.returnCarModifyTitle(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }
}
